﻿using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

namespace QFramework.Fullstack.Example.RollABall
{
	public class Player : MonoBehaviour
	{
		private IPlayerInput mInput = null;
		
		public float Speed  = 5;
		private void Awake()
		{
			GameConfig.Config();
			
			mInput = GameConfig.PlayerInput;
			
			mInput.OnInput += OnInput;
		}

		private void Update()
		{
			mInput.Update();
		}

		private void OnInput(PlayerInputData data)
		{
			this.transform.localPosition =  this.transform.localPosition +   Vector3.right * data.AxisX * Time.deltaTime * Speed;
			this.transform.localPosition =
				this.transform.localPosition + Vector3.forward * data.AxisY * Time.deltaTime * Speed;
		}
	}
}
